]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tools: Switch to flat config for eslint
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 10 Jun 2025 01:11:05 +0000 (03:11 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 30 Jul 2025 14:27:19 +0000 (14:27 +0000)
Both the .json and .yml config formats are deprecated in favor
of flat configs exported from eslint.config.js files.

The good news is that gjs' config is now available as a shared
config from the `eslint-config-gnome` package in World/javascript,
so we no longer have to copy the entire thing.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3746>

eslint.config.js [new symlink]
tools/eslint.config.js [new file with mode: 0644]
tools/package-lock.json
tools/package.json

diff --git a/eslint.config.js b/eslint.config.js
new file mode 120000 (symlink)
index 0000000..8e6e2c0
--- /dev/null
@@ -0,0 +1 @@
+tools/eslint.config.js
\ No newline at end of file
diff --git a/tools/eslint.config.js b/tools/eslint.config.js
new file mode 100644 (file)
index 0000000..82b8609
--- /dev/null
@@ -0,0 +1,81 @@
+// SPDX-FileCopyrightText: 2025 Florian Müllner <fmuellner@gnome.org>
+// SPDX-License-Identifier: MIT OR LGPL-2.1-or-later
+
+import {defineConfig} from '@eslint/config-helpers';
+import globals from 'globals';
+import gnome from 'eslint-config-gnome';
+
+export default defineConfig([
+    gnome.configs.recommended,
+    gnome.configs.jsdoc,
+    {
+        ignores: [
+            '_build-*',
+            'data',
+            'docs',
+            'man',
+            'src',
+            'subprojects/gvc',
+            'subprojects/jasmine-gjs',
+            'subprojects/libshew',
+        ],
+    }, {
+        rules: {
+            camelcase: ['error', {
+                properties: 'never',
+            }],
+            'consistent-return': 'error',
+            'eqeqeq': ['error', 'smart'],
+            'key-spacing': ['error', {
+                mode: 'minimum',
+                beforeColon: false,
+                afterColon: true,
+            }],
+            'prefer-arrow-callback': 'error',
+            'jsdoc/require-param-description': 'off',
+            'jsdoc/require-jsdoc': ['error', {
+                exemptEmptyFunctions: true,
+                publicOnly: {
+                    esm: true,
+                },
+            }],
+        },
+    }, {
+        files: [
+            'js/**',
+            'tests/shell/**',
+        ],
+        ignores: [
+            'js/portalHelper/*',
+            'js/extensions/*',
+        ],
+        languageOptions: {
+            globals: {
+                global: 'readonly',
+                _: 'readonly',
+                C_: 'readonly',
+                N_: 'readonly',
+                ngettext: 'readonly',
+            },
+        },
+    }, {
+        files: ['tests/unit/**'],
+        rules: {
+            'jsdoc/require-jsdoc': 'off',
+        },
+        languageOptions: {
+            globals: {
+                ...globals.jasmine,
+            },
+        },
+    }, {
+        files: ['subprojects/extensions-app/js/**'],
+        languageOptions: {
+            globals: {
+                _: 'readonly',
+                C_: 'readonly',
+                N_: 'readonly',
+            },
+        },
+    },
+]);
index 105bc1c4e45d7ee4551333e663330855146c0a2c..7e2fac92398eed88455b1e2f274cb9724c92bd08 100644 (file)
@@ -10,7 +10,7 @@
       "license": "MIT OR LGPL-3.0-or-later",
       "dependencies": {
         "ci-run-eslint": "git+https://gitlab.gnome.org/World/javascript/ci-run-eslint.git",
-        "eslint-plugin-jsdoc": "^48.11.0"
+        "eslint-config-gnome": "git+https://gitlab.gnome.org/World/javascript/eslint-config-gnome.git"
       }
     },
     "node_modules/@es-joy/jsdoccomment": {
     },
     "node_modules/eslint-config-gnome": {
       "version": "1.0.0",
-      "resolved": "git+https://gitlab.gnome.org/World/javascript/eslint-config-gnome.git#bb86b2d6a4ef575e84d1374676aff0187cf3fedf",
+      "resolved": "git+https://gitlab.gnome.org/World/javascript/eslint-config-gnome.git#c479d059e8d9ea99c3b53c2ea43abf7fdb05eb51",
       "license": "MIT OR LGPL-2.1-or-later",
       "dependencies": {
         "@eslint/config-helpers": "^0.2.2",
index 31d7d1d940d4229a9527657d4bcc978bcb40e8a8..6d5a089b5a8ac70b5ef2ce63b3293aadd3a10a5a 100644 (file)
@@ -9,6 +9,6 @@
   },
   "dependencies": {
     "ci-run-eslint": "git+https://gitlab.gnome.org/World/javascript/ci-run-eslint.git",
-    "eslint-plugin-jsdoc": "^48.11.0"
+    "eslint-config-gnome": "git+https://gitlab.gnome.org/World/javascript/eslint-config-gnome.git"
   }
 }